package com.rzcoding.dao;

import com.rzcoding.dto.dao.ManagerRoleNameMo;
import com.rzcoding.entity.Manager;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface ManagerMapper extends Mapper<Manager> {

    @Select({"<script>",
            "select m.id,m.username,m.create_time,m.role_id,m.mobile,m.email,m.state,r.role_name  " ,
                    "from manager m left join role r on m.role_id = r.id ",
            "<if test='userName!=null'>",
            "where m.username like concat ('${userName}','%') ",
            "</if>",
            "</script>"})
    List<ManagerRoleNameMo> selectByUsername(@Param(value = "userName") String userName);
}
